//package com.vast.admin.controller;
//
//
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.vast.admin.annotation.CurrentManager;
//import com.vast.admin.annotation.UseToken;
//import com.vast.admin.entity.Dict;
//import com.vast.common.core.domain.entity.SysUser;
//import com.vast.admin.entity.enums.QueryOrderEnum;
//import com.vast.admin.service.DictService;
//import com.vast.common.annotation.Log;
//import com.vast.common.core.domain.AjaxResult;
//import com.vast.common.constant.MessageCode;
//import com.vast.common.core.domain.Result;
//import io.swagger.annotations.*;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
///**
// * <p>
// *  前端控制器
// * </p>
// *
// * @author zhaohao
// * @since 2019-04-03
// */
//@Api(value="字典操作相关的api",tags= {"字典操作模块"})
//@RestController
//@RequestMapping("/manager/dict")
//public class DictController extends ApiController {
//
//	@Autowired
//	private DictService dictService;
//
//
//	@ApiOperation(value = "查询列表信息", notes = "通过条件查询列表")
//	@ApiImplicitParams({
//			@ApiImplicitParam(paramType = "query", name = "size", value = "分页条数", dataType = "int", defaultValue = "10", required = false),
//			@ApiImplicitParam(paramType = "query", name = "current", value = "页码,起始值:1", dataType = "int", defaultValue = "1", required = false),
//			@ApiImplicitParam(paramType = "query", name = "listMode", value = "是否集合模式:true不进行分页直接返回所有结果集", dataType = "boolean", defaultValue = "false", required = false),
//			@ApiImplicitParam(paramType = "query", name = "queryItems", value = "查询条件,json集合", defaultValue = "account,EQ,13419519796;", dataType = "String", required = false),
//			@ApiImplicitParam(paramType = "query", name = "orderField", value = "排序字段,多个','分隔", defaultValue = "create_time", dataType = "String",  required = false),
//			@ApiImplicitParam(paramType = "query", name = "order", value = "排序类型: ASC/DESC", dataType = "QueryOrderEnum",  required = false)
//	})
////	@Log(title = "查询列表信息")  //这里添加了AOP的自定义注解
//	@GetMapping("/page")
//	public Result<IPage<Dict>> page(@ApiParam(hidden = true) Page<Dict> page, boolean listMode, String queryItems, String orderField, QueryOrderEnum order) {
//		return new Result<IPage<Dict>>(MessageCode.SUCCESS, "获取成功", dictService.queryList(page, listMode, queryItems, orderField,order));
//
//	}
//	@ApiOperation(value = "查询列表信息", notes = "通过条件查询列表")
//	@ApiImplicitParams({
////			@ApiImplicitParam(paramType = "query", name = "size", value = "分页条数", dataType = "int", defaultValue = "10", required = false),
////			@ApiImplicitParam(paramType = "query", name = "current", value = "页码,起始值:1", dataType = "int", defaultValue = "1", required = false),
////			@ApiImplicitParam(paramType = "query", name = "listMode", value = "是否集合模式:true不进行分页直接返回所有结果集", dataType = "boolean", defaultValue = "false", required = false),
////			@ApiImplicitParam(paramType = "query", name = "queryItems", value = "查询条件,json集合", defaultValue = "account,EQ,13419519796;", dataType = "String", required = false),
////			@ApiImplicitParam(paramType = "query", name = "orderField", value = "排序字段,多个','分隔", defaultValue = "create_time", dataType = "String",  required = false),
//			@ApiImplicitParam(paramType = "query", name = "type", value = "类型", defaultValue = "", dataType = "String",  required = true),
//			@ApiImplicitParam(paramType = "query", name = "order", value = "排序类型: ASC/DESC", dataType = "QueryOrderEnum",  required = false)
//	})
////	@Log(title = "查询列表信息")  //这里添加了AOP的自定义注解
//	@GetMapping("/list")
//	public Result<IPage<Dict>> list(@ApiParam(hidden = true) Page<Dict> page,String type) {
//		page.setSize(-1);
//		return new Result<IPage<Dict>>(MessageCode.SUCCESS, "获取成功", dictService.page(page,new QueryWrapper<Dict>().eq(Dict.COL_TYPE,type).ne(Dict.COL_PARENT_ID,0)));
//
//	}
//
//	@ApiOperation(value = "添加或更新", notes = "添加或更新")
//	@UseToken
//	@PostMapping("/addOrUpdate")
//	@Log(title = "添加或更新字典")
//	public Result<Dict> addOrUpdate(@ApiParam(hidden = true)@CurrentManager SysUser manager, @RequestBody @ApiParam(name="Dict",value="Dict信息",required=true) Dict dict) {
//		if(dict != null) {
//			boolean flag  = dictService.addOrUpdate(manager, dict);
//			if(flag){
//				return new Result<Dict>(MessageCode.SUCCESS, "添加成功", dict);
//			}else{
//				return new Result<Dict>(MessageCode.ERROR, "添加失败");
//			}
//		}else {
//			return new Result<Dict>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//
//	@ApiOperation(value = "通过id获取详情", notes = "通过id获取详情")
//	@ApiImplicitParams({ @ApiImplicitParam(paramType = "header", name = "token", value = "登录获取的token", dataType = "String", required = true)})
//	@GetMapping("/info/{id}")
//	@UseToken
//	@Log(title = "通过id获取详情")
//	public Result<Dict> info(@ApiParam(hidden = true) @CurrentManager SysUser manager,@PathVariable("id") Long id) {
//		if(id != null && id.longValue() > 0){
//			Dict dict = dictService.info(manager,id);
//			if(dict != null){
//				return new Result<Dict>(MessageCode.SUCCESS, "获取成功", dict);
//			}else{
//				return new Result<Dict>(MessageCode.ERROR, "获取失败");
//			}
//		}
//		return new Result<Dict>(MessageCode.PARAM_ERROR, "id不能为空");
//	}
//
//	@ApiOperation(value = "删除字典", notes = "删除字典")
//	@UseToken
//	@Log(title = "删除字典")
//	@DeleteMapping("/delete")
//	public Result<Boolean> delete(@ApiParam(hidden = true)@CurrentManager SysUser manager, @RequestBody @ApiParam(name="ids",value="数据id数组,以','分隔",required=true) Long[] ids) {
//		if(ids != null) {
//			boolean flag  = dictService.delete(manager, ids);
//			if(flag){
//				return new Result<Boolean>(MessageCode.SUCCESS, "删除成功");
//			}else{
//				return new Result<Boolean>(MessageCode.ERROR, "删除失败");
//			}
//		}else {
//			return new Result<Boolean>(MessageCode.PARAM_ERROR, "参数错误");
//		}
//	}
//
//
//
//	/**
//	 * 根据字典类型查询字典数据信息
//	 */
//	@GetMapping(value = "/data/type/{dictType}")
//	public AjaxResult dictType(@PathVariable String dictType)
//	{
//		return AjaxResult.success(dictService.selectDictDataByType(dictType));
//	}
//
//
//	/**
//	 * 根据参数键名查询参数值
//	 */
//	@GetMapping(value = "/configKey/{configKey}")
//	public AjaxResult getConfigKey(@PathVariable String configKey)
//	{
//		return AjaxResult.success(dictService.selectConfigByKey(configKey));
//	}
//
//	@GetMapping("/type/list")
//	public Result<IPage<Dict>> list(@ApiParam(hidden = true) Page<Dict> page, Dict dict)
//	{
//		IPage<Dict> list = dictService.selectDictTypeList(page,dict);
//		return new Result<IPage<Dict>>(MessageCode.SUCCESS, "获取成功", list);
//	}
//
//
//	/**
//	 * 查询字典类型详细
//	 */
//	@GetMapping(value = "/type/{dictId}")
//	public Result<Dict> getInfo(@PathVariable Long dictId)
//	{
//		return new Result<Dict>(MessageCode.SUCCESS, "获取成功", dictService.selectDictTypeById(dictId));
//	}
//
//	@GetMapping("/data/list")
//	public Result<IPage<Dict>> getDictTypeDatalist(@ApiParam(hidden = true) Page<Dict> page, Dict dict)
//	{
//		IPage<Dict> list = dictService.selectDictDataList(page, dict);
//		return new Result<IPage<Dict>>(MessageCode.SUCCESS, "获取成功", list);
//	}
//
//	/**
//	 * 新增字典类型
//	 */
//	@PostMapping("/type")
//	public Result<Boolean> add(@ApiParam(hidden = true) @CurrentManager SysUser manager,@Validated @RequestBody Dict dict){
//		if(dict.getParentId() == null){
//			dict.setParentId(0L);
//		}
//		dict.setCreateBy(manager.getUserId());
//
//		return new Result<Boolean>(MessageCode.SUCCESS, "添加成功", dictService.save(dict));
//	}
//
//	/**
//	 * 修改保存字典类型
//	 */
//	@PutMapping("/type")
//	public Result<Boolean> edit(@ApiParam(hidden = true) @CurrentManager SysUser manager,@Validated @RequestBody Dict dict){
//
//		dict.setUpdateBy(manager.getUserId());
//		return new Result<Boolean>(MessageCode.SUCCESS, "修改成功", dictService.updateById(dict));
//	}
//
//	/**
//	 * 删除字典类型
//	 */
//	@DeleteMapping("/type/{dictCodes}")
//	public Result<Boolean> remove(@ApiParam(hidden = true) @CurrentManager SysUser manager,@PathVariable Long[] dictCodes)
//	{
//		return new Result<Boolean>(MessageCode.SUCCESS, "修改成功",dictService.delete(manager,dictCodes));
//	}
//}
